<p>
  Overlay of all samples tagged with  "<code><% $tag %></code>"
</p>
<table>
  <tr>
    <td colspan="2" style="color: white; background-color: #555">
      <b>Heat Map</b>
    <td>
  </tr>
%       foreach my $tuple ( @tag ) {
%         my ($set, $sample) = @$tuple;
%         my $filename = "$TRFLP::data_path/$set/$sample.peak";
              <tr>
                <td style="color: white; background-color: black">
                  <% "$set:<b>$sample</b>" %>
                </td>
                <td style="background-color: black"><img border="0" src="plot_heatmap.html?key=<% $sample %>;file=<% $filename %>"></td>
              </tr>
%       }
</table>

<table>
  <tr>
    <td colspan="2" style="color: white; background-color: #555">
      <b>Warped Standard Signal</b>
    <td>
  </tr>
  <tr>
    <td style="background-color: black"><img border="0" src="plot_overlayed.html?signal=warped%20sample;files=<% join(":", @sample_file) %>"</td>
  </tr>
</table>

<table>
  <tr>
    <td colspan="2" style="color: white; background-color: #555">
      <b>Warped Sample</b>
    <td>
  </tr>
  <tr>
    <td style="background-color: black"><img border="0" src="plot_overlayed.html?signal=warped%20ladder;files=<% join(":", @sample_file) %>"</td>
  </tr>
</table>
<%args>
  $tag
</%args>
<%init>
  my $query = qq(
SELECT sample_tag."set", sample_tag."id"
  FROM sample_tag
 WHERE sample_tag."key" = '$tag'
);
print $query;
  my $res = $Dbh->selectall_arrayref($query);
  $Dbh->err and die $Dbh->errstr . " in query: [$query]";
  my @tag = @$res;
  my @sample_file;
  foreach my $tuple ( @tag ) {
    my ($set, $sample) = @$tuple;
    push @sample_file, "$TRFLP::data_path/$set/$sample";
  }
</%init>
